package com.cqhilink.iot.jobstandardmanagement.services.innerservice.impl.intdateinfo;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cqhilink.iot.jobstandardmanagement.dao.mapper.IntDataSrcItemValueMapper;
import com.cqhilink.iot.jobstandardmanagement.facade.model.IntDataSrcItemValue;
import com.cqhilink.iot.jobstandardmanagement.facade.service.intdateinfo.JsmIntDataInfoService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by zmling on 2017/6/9.
 */
public class JsmIntDataInfoServiceImpl implements JsmIntDataInfoService{
    @Autowired
    private IntDataSrcItemValueMapper intDataSrcItemValueMapper;

    /**
     *
     * @param intDataSrcItemValue 插入到数据项中
     * @return
     * @throws Exception
     */
    @Override
    public JSONObject getIntDataSrcItemTableJson(IntDataSrcItemValue intDataSrcItemValue) throws Exception {
        JSONObject jsonObject=new JSONObject();
        List<IntDataSrcItemValue> intDataSrcItemList=intDataSrcItemValueMapper.selectIntDataSrcItemTableList(intDataSrcItemValue);
        jsonObject.put("total",intDataSrcItemValueMapper.selectIntDataSrcItemTableCount(intDataSrcItemValue));
        jsonObject.put("rows", JSON.toJSON(intDataSrcItemList));
        return jsonObject;
    }
}
